<?php

require_once 'lib.php';

/**
 * Description of ExamModifier
 *
 * @author markus
 */
class ExamModifier {
    private $connection;
    private $exam;
    
    function __construct(ActionsConnection $connection, $exam, $locale = "de"){
        $this->url = "https://actions.fh-joanneum.at/st/listMarks.do?locale=".$locale;
        $this->connection = $connection;
        $this->exam = $exam;
        
        logger("ExamModifier", $this->connection->status, $this->connection->key);
    }
    
    public function signup(){
        $e = curl_init("https://actions.fh-joanneum.at/exams/administration.do");
        $data = $this->exam."=1&register=Anmelden";
        curl_setopt($e, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($e, CURLOPT_COOKIEFILE, $this->connection->getFile());
        curl_setopt($e, CURLOPT_COOKIEJAR, $this->connection->getFile());
        curl_setopt($e, CURLOPT_POSTFIELDS, $data);
        curl_setopt($e, CURLOPT_REFERER, "https://actions.fh-joanneum.at/exams/administration.do");
        curl_setopt($e, CURLOPT_HEADER, 0);
        curl_setopt($d, CURLOPT_POST, 1);

        $content = curl_exec($e);
        
        curl_close($e);
    }
    
    public function signoff(){
        $e = curl_init("https://actions.fh-joanneum.at/exams/administration.do");
        $data = $this->exam."=1&signOff=Anmelden";
        curl_setopt($e, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($e, CURLOPT_COOKIEFILE, $this->connection->getFile());
        curl_setopt($e, CURLOPT_COOKIEJAR, $this->connection->getFile());
        curl_setopt($e, CURLOPT_POSTFIELDS, $data);
        curl_setopt($e, CURLOPT_REFERER, "https://actions.fh-joanneum.at/exams/administration.do");
        curl_setopt($e, CURLOPT_HEADER, 0);
        curl_setopt($d, CURLOPT_POST, 1);

        $content = curl_exec($e);

        curl_close($e);
    }
    
    
}

?>
